using ASP;
using HoWave.Common;
using HoWave.Web;
using HoWave.Web.Shop.Member;
using System;
using System.Collections;
using System.Data;
using System.Web.Profile;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
public class Member_Shop_PayMents : Member, IRequiresSessionState
{
	protected ScriptManager ScriptManager1;
	protected TextBox TxtUserName;
	protected TextBox TxtOrderFormNum;
	protected TextBox TxtBeginDate;
	protected TextBox TxtEndDate;
	protected Button QuickSearchBtn;
	protected DropDownList DropMoneyType;
	protected GridView GridView1;
	private string wherestr = "";
	private ArrayList al = new ArrayList();
	private IDbDataParameter[] param = null;
	protected DefaultProfile Profile
	{
		get
		{
			return (DefaultProfile)this.Context.Profile;
		}
	}
	protected global_asax ApplicationInstance
	{
		get
		{
			return (global_asax)this.Context.ApplicationInstance;
		}
	}
	protected void Page_Load(object sender, EventArgs e)
	{
		this.GridView1.PageIndexChanging += new GridViewPageEventHandler(this.GridView1_PageIndexChanging);
		if (!base.IsPostBack)
		{
			this.BindList();
		}
		this.TxtBeginDate.Attributes.Add("onclick", "SelectDate(" + this.TxtBeginDate.UniqueID + ",'yyyy-MM-dd');");
		this.TxtEndDate.Attributes.Add("onclick", "SelectDate(" + this.TxtEndDate.UniqueID + ",'yyyy-MM-dd');");
	}
	public string GeteBankID(string eBankID)
	{
		string result = string.Empty;
		string text = eBankID.ToLower();
		string text2 = text;
		switch (text2)
		{
		case "alipay":
			result = "支付宝";
			return result;
		case "chinabank":
			result = "网银";
			return result;
		case "quickbill":
			result = "快线";
			return result;
		case "trafutonq":
			result = "财付通";
			return result;
		case "shopbank":
			result = "商城支付";
			return result;
		case "vip":
			result = "VIP卡支付";
			return result;
		case "gift":
			result = "礼品卡支付";
			return result;
		case "lottery":
			result = "中奖券支付";
			return result;
		}
		result = eBankID;
		return result;
	}
	protected void BindList()
	{
		this.QuestString();
		if (this.al.Count > 0)
		{
			this.param = new IDbDataParameter[this.al.Count];
			this.al.CopyTo(this.param, 0);
		}
		Shop_PayInfo shop_PayInfo = new Shop_PayInfo(this.conn);
		if (this.param == null)
		{
			this.GridView1.DataSource = shop_PayInfo.GetPayInfoByUserID(this.wherestr, base.user.UserID, new IDbDataParameter[0]);
		}
		else
		{
			this.GridView1.DataSource = shop_PayInfo.GetPayInfoByUserID(this.wherestr, base.user.UserID, this.param);
		}
		this.GridView1.DataBind();
	}
	public string GetOrderStatus(string PayStatus)
	{
		string result;
		if (PayStatus.ToLower() == "pay")
		{
			result = "支付完成";
		}
		else
		{
			result = "未提交";
		}
		return result;
	}
	protected void QuestString()
	{
		string text = this.TxtUserName.Text;
		if (text != string.Empty)
		{
			if (!Text.ProcessSqlStr(text))
			{
				this.WriteErrMsg("", Language.Get("Common/ParamErr"), "");
			}
			this.wherestr += "and SalerID in(select UserID From [HL_User] Where UserName like '%'+@UserName+'%') ";
			this.al.Add(this.conn.CreateParameter("@UserName", DbType.String, text.Trim()));
		}
		string text2 = this.TxtBeginDate.Text;
		if (text2 != string.Empty)
		{
			if (!Text.IsDate(text2))
			{
				this.WriteErrMsg("", Language.Get("Common/DateTimeFormatErr"), "");
			}
			this.wherestr += "and DateDiff(dd,PayTime, @BeginDate)<=0 ";
			this.al.Add(this.conn.CreateParameter("@BeginDate", DbType.DateTime, text2));
		}
		string text3 = this.TxtEndDate.Text;
		if (text3 != string.Empty)
		{
			if (!Text.IsDate(text3))
			{
				this.WriteErrMsg("", Language.Get("Common/DateTimeFormatErr"), "");
			}
			if (text2 != string.Empty)
			{
				if (Convert.ToDateTime(text2) > Convert.ToDateTime(text3))
				{
					this.WriteErrMsg("", Language.Get("Common/DateTimeErr"), "");
				}
			}
			this.wherestr += "and DateDiff(dd,PayTime, @EndDate)>=0 ";
			this.al.Add(this.conn.CreateParameter("@EndDate", DbType.DateTime, text3));
		}
		string selectedValue = this.DropMoneyType.SelectedValue;
		if (selectedValue != string.Empty)
		{
			if (selectedValue == "0")
			{
				this.wherestr += "and eBankID<>'Alipay' and eBankID<>'NetBank' and eBankID<>'ShopBank' ";
			}
			else
			{
				if (selectedValue == "1")
				{
					this.wherestr += "and (eBankID='Alipay' or eBankID='NetBank') ";
				}
				else
				{
					if (selectedValue == "2")
					{
						this.wherestr += "and eBankID='ShopBank' ";
					}
				}
			}
		}
		string text4 = this.TxtOrderFormNum.Text;
		if (text4 != string.Empty)
		{
			if (!Text.ProcessSqlStr(text4))
			{
				this.WriteErrMsg("", Language.Get("Common/ParamErr"), "");
			}
			this.wherestr += "and OrderFormNum like '%'+@OrderFormNum+'%' ";
			this.al.Add(this.conn.CreateParameter("@OrderFormNum", DbType.String, text4.Trim()));
		}
		if (this.wherestr != string.Empty)
		{
			this.wherestr = "and" + this.wherestr;
			this.wherestr = this.wherestr.Replace("andand", "");
		}
	}
	protected void SearchClick(object sender, EventArgs e)
	{
		this.BindList();
	}
	private void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
	{
		this.GridView1.PageIndex = e.NewPageIndex;
		this.BindList();
	}
}
